/*
package org.example.handler;

import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.SimpleChannelInboundHandler;
import io.netty5.handler.codec.http.websocketx.TextWebSocketFrame;

public class StompWebSocketFrameHandler extends SimpleChannelInboundHandler<TextWebSocketFrame>{
    @Override
    protected void messageReceived(ChannelHandlerContext ctx, TextWebSocketFrame msg) {
        String request = msg.text();
        System.out.println("Received WebSocket message: " + request);

        // 假设 STOMP 消息格式为简单的文本格式（手动解析）
        if (request.startsWith("CONNECT")) {
            // 处理 STOMP CONNECT 消息
            ctx.writeAndFlush(new TextWebSocketFrame(ctx.bufferAllocator().copyOf("CONNECTED\nversion:1.2\n\n\u0000".getBytes())));
        } else if (request.startsWith("SUBSCRIBE")) {
            // 处理 STOMP SUBSCRIBE 消息
            System.out.println("Subscription received: " + request);
            // 发送 STOMP 订阅确认
            ctx.writeAndFlush(new TextWebSocketFrame(ctx.bufferAllocator().copyOf("MESSAGE\nsubscription:sub-0\n\nHello from server\u0000".getBytes())));
        } else if (request.startsWith("SEND")) {
            // 处理 STOMP SEND 消息
            System.out.println("Message sent: " + request);
            ctx.writeAndFlush(new TextWebSocketFrame(ctx.bufferAllocator().copyOf("RECEIPT\nreceipt-id:msg-0\n\n\u0000".getBytes())));
        } else if (request.startsWith("DISCONNECT")) {
            // 处理 STOMP DISCONNECT 消息
            ctx.writeAndFlush(new TextWebSocketFrame(ctx.bufferAllocator().copyOf("RECEIPT\nreceipt-id:disconnect-0\n\n\u0000".getBytes())));
            ctx.close();
        } else {
            System.out.println("Unknown message: " + request);
        }
    }

}

*/
